﻿#region Using Statements
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
using JigLibX.Collision;
using JigLibX.Physics;
using JigLibX.Geometry;
using JigLibX.Math;
using Microsoft.Xna.Framework.Graphics;
using sqengine.Components;
#endregion


namespace sqengine.PhysicObjects
{
    public class ItmWebBox2d : MovableObject
    {

        private int browser_id = -1;
        private InputBox inp_box;

        public ItmWebBox2d(Game game, string ObjName, Model model, Matrix orientation, float ObjScale, Vector3 position)
            : base(game, ObjName, model, orientation, ObjScale, position, true)
        {
            collision.RemoveAllPrimitives();
            Sphere b_prim = new Sphere(Vector3.Zero * 5.0f, ObjScale);
            collision.AddPrimitive(b_prim, new MaterialProperties(0.8f, 0.8f, 0.7f));

            ActionDistance = -1f;
            inp_box = new InputBox(game, Adcontent, ((sqengine)game).Keyman, "Fonts/Visitor");
            inp_box.DrawOrder = 1;
            inp_box.OnClose += new InputBox.InputHandler(inp_box_OnClose);
            CurrentGame.Components.Add(inp_box);

            

            OnAction += new ActionHandler(ItmWebBox2d_OnAction);

        }

        void inp_box_OnClose(object sender, InputBox.InputArg ca)
        {
            ((sqengine)CurrentGame).Console.ExecCommand(string.Format("navigate {0}",ca.Input()));

        }

        void ItmWebBox2d_OnAction(object sender, ActionArg ca)
        {
            inp_box.Show(-1, -1);
        
        }


        public override void ApplyEffects(BasicEffect effect)
        {



        }



    }
}
